#include "RoleProxy.h"


RoleProxy::RoleProxy(void)
	:_localPlayer(nullptr)
{
	clearRoleList();

	SocketMgr::inst()->addEventListener( 1, this, &RoleProxy::netRoleInfo );
	netRoleInfo(nullptr);
}


RoleProxy::~RoleProxy(void)
{

	SocketMgr::inst()->removeEventListener( 1, this, &RoleProxy::netRoleInfo );
}

void RoleProxy::netRoleInfo( TagNetMsg* info )
{
	_localPlayer = new Role();

	EventMgr::inst()->sendEvent("ns_RoleInfo");
}



void RoleProxy::addRole( Role* role )
{

}

void RoleProxy::clearRoleList()
{
	auto it = _roleList.begin();
	for (; it!=_roleList.end(); it++)
	{
		delete it->second;
	}
	_roleList.clear();
}
